<template>
  <!-- 活动列表组件 -->
  <div class="li-wrap" :style="showLine(index,'bg')">
    <div class="li-left">
      <img :src="item.imageUrl" />
      <nuxt-link to="/login" class="li-left-btn" :style="showLine(index)">了解详情</nuxt-link>
    </div>
    <div class="li-right">
      <div class="li-right-top">
        <div class="title">{{item.title}}</div>
        <div class="details">{{item.content}}</div>
        <!-- <div class="state">活动进行中</div> -->
      </div>
      <div class="time">
        <img src="../assets/images/h-time-icon.png" alt="" />
        <p>活动时间：{{item.startTime}}</p>
      </div>
    </div>
  </div>
</template>

<script>

export default { 
  props: {
    item: {
      type: Object,
      default: () => {
        return {}
      }
    },
    index: {
      type: Number,
      default: 0
    }
  },
  components: {
  },
  methods: {
    showLine(index,type='txt') { // 显示动态
      let obj = {}
      if (type === 'bg') {
        if (index%3 === 0) {
          obj.background = '#e5f6ff'
        } else if (index%3 === 1) {
          obj.background = '#ffeeed'
        } else {
          obj.background = '#e1fdea'
        }
      } else {
        if (index%3 === 0) {
          obj.background = '#4187f7'
        } else if (index%3 === 1) {
          obj.background = '#f87169'
        } else {
          obj.background = '#48a267'
        }
      }
      return obj
    }
  }
}
</script>

<style scoped>
  .li-wrap {
    width: 100%;
    height: 430px;
    background: #e5f6ff;
    display: flex;
    border-radius: 5px;
    margin-top: 20px;
  }
  .li-left {
    width: 720px;
    height: 430px;
    position: relative;
  }
  .li-left img {
    width: 720px;
    height: 430px;
  }
  .li-right {
    width: 478px;
    height: 430px;
  }
  .li-left-btn {
    font-size: 18px;
    color: #fff;
    background: #4187f7;
    border-radius: 100px;
    width: 120px;
    height: 36px;
    text-align: center;
    line-height: 36px;
    position: absolute;
    right: 30px;
    bottom: 36px;
    z-index: 2;
    cursor: pointer;
  }
  .li-right-top {
    margin-top: 72px;
    padding-left: 84px;
    width: 310px;
  }
  .li-right-top .title {
    font-size: 30px;
    color: #333;
  }
  .li-right-top .details {
    font-size: 16px;
    color: #333;
    line-height: 1.5;
    margin-top: 29px;
  }
  .li-right-top .state {
    width: 200px;
    height: 44px;
    border:1px solid #e74f60;
    background: #fff;
    box-sizing: border-box;
    text-align: center;
    color: #e74f60;
    line-height: 44px;
    font-size: 20px;
    margin-top: 50px;
    cursor: default;
  }
  .li-right .time {
    width: 355px;
    border-top: 1px solid #e1e1e1;
    margin: 52px auto 0 auto;
    display: flex;
    align-items: center;
    padding-left: 45px;
    padding-top: 30px;
  }
  .li-right .time img {
    width: 18px;
    height: 18px;
  }
  .li-right .time p {
    color: #333;
    font-size: 16px;
    margin-left: 9px;
    flex: 1;
  }
</style>
